/**
 * 
 */
package com.googlecode.bip.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;

/**
 * Build a list of item T from a SQL query
 * 
 * @author Claude CHOISNET
 */
public interface Listable <T>
{
    /**
     * Build a list of item T from a SQL query
     * 
     * @param sql SQL query to find T item in data base 
     * @return a list of <T> (not null)
     * @throws SQLException
     * @throws NamingException 
     */
    public List<T> getList(String sql) throws SQLException, NamingException;
    
    /**
     * Create an T item for a {@link ResultSet}
     * 
     * @param resultSet a valid ResultSet 
     * @return T item
     * @throws SQLException
     */
    public T newInstance( ResultSet resultSet ) throws SQLException;
}
